package part1.api.io.iotest;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
//        FileInputStream fis = new FileInputStream("下载.jpg");
//        FileOutputStream fos = new FileOutputStream("下载1.jpg");
//        int d ;
//        while ((d=fis.read()) !=-1){
//            fos.write(d);
//        }
//        System.out.println("复制完毕");
//        fis.close();
//        fos.close();

//        FileInputStream fis = new FileInputStream("壁纸2.png");
//        FileOutputStream fos = new FileOutputStream("壁纸3.png");
//        int d;
//        while ((d=fis.read())!=-1){
//            fos.write(d);
//        }
//        fis.close();
//        fos.close();


        FileInputStream fis = new FileInputStream("fot.txt");
        FileOutputStream fos = new FileOutputStream("fot1.txt");
        int d;
        while ((d=fis.read()) !=-1){
            System.out.println(d);
            fos.write(d);
        }
        fis.close();
        fos.close();

    }
}
